﻿using System;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdEdCommandStackReactor : OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdEdCommandStackReactor(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdEdCommandStackReactor_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdEdCommandStackReactor obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdEdCommandStackReactor()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdEdCommandStackReactor(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdEdCommandStackReactor() : this(GlobalsPINVOKE.new_OdEdCommandStackReactor(), MemoryManager.GetMemoryManager().GetCurrentTransaction() == null)
		{
			MemoryTransaction currentTransaction = MemoryManager.GetMemoryManager().GetCurrentTransaction();
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(new OdEdCommandStackReactor(this.swigCPtr.Handle, true));
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			this.SwigDirectorConnect();
		}

		public new static OdEdCommandStackReactor cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdCommandStackReactor_cast(OdRxObject.getCPtr(pObj));
			OdEdCommandStackReactor result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdEdCommandStackReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdEdCommandStackReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdEdCommandStackReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdEdCommandStackReactor_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(this.SwigDerivedClassHasMethod("isA", OdEdCommandStackReactor.swigMethodTypes1) ? GlobalsPINVOKE.OdEdCommandStackReactor_isASwigExplicitOdEdCommandStackReactor(this.swigCPtr) : GlobalsPINVOKE.OdEdCommandStackReactor_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(this.SwigDerivedClassHasMethod("queryX", OdEdCommandStackReactor.swigMethodTypes0) ? GlobalsPINVOKE.OdEdCommandStackReactor_queryXSwigExplicitOdEdCommandStackReactor(this.swigCPtr, OdRxClass.getCPtr(protocolClass)) : GlobalsPINVOKE.OdEdCommandStackReactor_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdEdCommandStackReactor createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdCommandStackReactor_createObject();
			OdEdCommandStackReactor result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdEdCommandStackReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdEdCommandStackReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdEdCommandStackReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void commandAdded(OdEdCommand pCommand)
		{
			if (this.SwigDerivedClassHasMethod("commandAdded", OdEdCommandStackReactor.swigMethodTypes2))
			{
				GlobalsPINVOKE.OdEdCommandStackReactor_commandAddedSwigExplicitOdEdCommandStackReactor(this.swigCPtr, OdEdCommand.getCPtr(pCommand));
			}
			else
			{
				GlobalsPINVOKE.OdEdCommandStackReactor_commandAdded(this.swigCPtr, OdEdCommand.getCPtr(pCommand));
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void commandWillBeRemoved(OdEdCommand pCommand)
		{
			if (this.SwigDerivedClassHasMethod("commandWillBeRemoved", OdEdCommandStackReactor.swigMethodTypes3))
			{
				GlobalsPINVOKE.OdEdCommandStackReactor_commandWillBeRemovedSwigExplicitOdEdCommandStackReactor(this.swigCPtr, OdEdCommand.getCPtr(pCommand));
			}
			else
			{
				GlobalsPINVOKE.OdEdCommandStackReactor_commandWillBeRemoved(this.swigCPtr, OdEdCommand.getCPtr(pCommand));
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void commandWillStart(OdEdCommand pCommand, OdEdCommandContext pCmdCtx)
		{
			if (this.SwigDerivedClassHasMethod("commandWillStart", OdEdCommandStackReactor.swigMethodTypes4))
			{
				GlobalsPINVOKE.OdEdCommandStackReactor_commandWillStartSwigExplicitOdEdCommandStackReactor(this.swigCPtr, OdEdCommand.getCPtr(pCommand), OdEdCommandContext.getCPtr(pCmdCtx));
			}
			else
			{
				GlobalsPINVOKE.OdEdCommandStackReactor_commandWillStart(this.swigCPtr, OdEdCommand.getCPtr(pCommand), OdEdCommandContext.getCPtr(pCmdCtx));
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void commandEnded(OdEdCommand pCommand, OdEdCommandContext pCmdCtx)
		{
			if (this.SwigDerivedClassHasMethod("commandEnded", OdEdCommandStackReactor.swigMethodTypes5))
			{
				GlobalsPINVOKE.OdEdCommandStackReactor_commandEndedSwigExplicitOdEdCommandStackReactor(this.swigCPtr, OdEdCommand.getCPtr(pCommand), OdEdCommandContext.getCPtr(pCmdCtx));
			}
			else
			{
				GlobalsPINVOKE.OdEdCommandStackReactor_commandEnded(this.swigCPtr, OdEdCommand.getCPtr(pCommand), OdEdCommandContext.getCPtr(pCmdCtx));
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void commandCancelled(OdEdCommand pCommand, OdEdCommandContext pCmdCtx)
		{
			if (this.SwigDerivedClassHasMethod("commandCancelled", OdEdCommandStackReactor.swigMethodTypes6))
			{
				GlobalsPINVOKE.OdEdCommandStackReactor_commandCancelledSwigExplicitOdEdCommandStackReactor(this.swigCPtr, OdEdCommand.getCPtr(pCommand), OdEdCommandContext.getCPtr(pCmdCtx));
			}
			else
			{
				GlobalsPINVOKE.OdEdCommandStackReactor_commandCancelled(this.swigCPtr, OdEdCommand.getCPtr(pCommand), OdEdCommandContext.getCPtr(pCmdCtx));
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void commandFailed(OdEdCommand pCommand, OdEdCommandContext pCmdCtx)
		{
			if (this.SwigDerivedClassHasMethod("commandFailed", OdEdCommandStackReactor.swigMethodTypes7))
			{
				GlobalsPINVOKE.OdEdCommandStackReactor_commandFailedSwigExplicitOdEdCommandStackReactor(this.swigCPtr, OdEdCommand.getCPtr(pCommand), OdEdCommandContext.getCPtr(pCmdCtx));
			}
			else
			{
				GlobalsPINVOKE.OdEdCommandStackReactor_commandFailed(this.swigCPtr, OdEdCommand.getCPtr(pCommand), OdEdCommandContext.getCPtr(pCmdCtx));
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdEdCommand unknownCommand(string commandName, OdEdCommandContext pCmdCtx)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = this.SwigDerivedClassHasMethod("unknownCommand", OdEdCommandStackReactor.swigMethodTypes8) ? GlobalsPINVOKE.OdEdCommandStackReactor_unknownCommandSwigExplicitOdEdCommandStackReactor(this.swigCPtr, commandName, OdEdCommandContext.getCPtr(pCmdCtx)) : GlobalsPINVOKE.OdEdCommandStackReactor_unknownCommand(this.swigCPtr, commandName, OdEdCommandContext.getCPtr(pCmdCtx));
			OdEdCommand result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private void SwigDirectorConnect()
		{
			if (this.SwigDerivedClassHasMethod("queryX", OdEdCommandStackReactor.swigMethodTypes0))
			{
				this.swigDelegate0 = new OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_0(this.SwigDirectorqueryX);
			}
			if (this.SwigDerivedClassHasMethod("isA", OdEdCommandStackReactor.swigMethodTypes1))
			{
				this.swigDelegate1 = new OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_1(this.SwigDirectorisA);
			}
			if (this.SwigDerivedClassHasMethod("commandAdded", OdEdCommandStackReactor.swigMethodTypes2))
			{
				this.swigDelegate2 = new OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_2(this.SwigDirectorcommandAdded);
			}
			if (this.SwigDerivedClassHasMethod("commandWillBeRemoved", OdEdCommandStackReactor.swigMethodTypes3))
			{
				this.swigDelegate3 = new OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_3(this.SwigDirectorcommandWillBeRemoved);
			}
			if (this.SwigDerivedClassHasMethod("commandWillStart", OdEdCommandStackReactor.swigMethodTypes4))
			{
				this.swigDelegate4 = new OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_4(this.SwigDirectorcommandWillStart);
			}
			if (this.SwigDerivedClassHasMethod("commandEnded", OdEdCommandStackReactor.swigMethodTypes5))
			{
				this.swigDelegate5 = new OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_5(this.SwigDirectorcommandEnded);
			}
			if (this.SwigDerivedClassHasMethod("commandCancelled", OdEdCommandStackReactor.swigMethodTypes6))
			{
				this.swigDelegate6 = new OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_6(this.SwigDirectorcommandCancelled);
			}
			if (this.SwigDerivedClassHasMethod("commandFailed", OdEdCommandStackReactor.swigMethodTypes7))
			{
				this.swigDelegate7 = new OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_7(this.SwigDirectorcommandFailed);
			}
			if (this.SwigDerivedClassHasMethod("unknownCommand", OdEdCommandStackReactor.swigMethodTypes8))
			{
				this.swigDelegate8 = new OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_8(this.SwigDirectorunknownCommand);
			}
			GlobalsPINVOKE.OdEdCommandStackReactor_director_connect(this.swigCPtr, this.swigDelegate0, this.swigDelegate1, this.swigDelegate2, this.swigDelegate3, this.swigDelegate4, this.swigDelegate5, this.swigDelegate6, this.swigDelegate7, this.swigDelegate8);
		}

		private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes)
		{
			MethodInfo method = base.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, methodTypes, null);
			return method.DeclaringType.IsSubclassOf(typeof(OdEdCommandStackReactor));
		}

		private IntPtr SwigDirectorqueryX(IntPtr protocolClass)
		{
			return OdRxObject.getCPtr(this.queryX((OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(protocolClass, false))).Handle;
		}

		private IntPtr SwigDirectorisA()
		{
			return OdRxClass.getCPtr(this.isA()).Handle;
		}

		private void SwigDirectorcommandAdded(IntPtr pCommand)
		{
			this.commandAdded((OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(pCommand, false));
		}

		private void SwigDirectorcommandWillBeRemoved(IntPtr pCommand)
		{
			this.commandWillBeRemoved((OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(pCommand, false));
		}

		private void SwigDirectorcommandWillStart(IntPtr pCommand, IntPtr pCmdCtx)
		{
			this.commandWillStart((OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(pCommand, false), (OdEdCommandContext)Teigha.Core.Helpers.odrxCreateObjectInternal(pCmdCtx, false));
		}

		private void SwigDirectorcommandEnded(IntPtr pCommand, IntPtr pCmdCtx)
		{
			this.commandEnded((OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(pCommand, false), (OdEdCommandContext)Teigha.Core.Helpers.odrxCreateObjectInternal(pCmdCtx, false));
		}

		private void SwigDirectorcommandCancelled(IntPtr pCommand, IntPtr pCmdCtx)
		{
			this.commandCancelled((OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(pCommand, false), (OdEdCommandContext)Teigha.Core.Helpers.odrxCreateObjectInternal(pCmdCtx, false));
		}

		private void SwigDirectorcommandFailed(IntPtr pCommand, IntPtr pCmdCtx)
		{
			this.commandFailed((OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(pCommand, false), (OdEdCommandContext)Teigha.Core.Helpers.odrxCreateObjectInternal(pCmdCtx, false));
		}

		private IntPtr SwigDirectorunknownCommand([MarshalAs(UnmanagedType.LPWStr)] string commandName, IntPtr pCmdCtx)
		{
			return OdEdCommand.getCPtr(this.unknownCommand(commandName, (OdEdCommandContext)Teigha.Core.Helpers.odrxCreateObjectInternal(pCmdCtx, false))).Handle;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		private OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_0 swigDelegate0;

		private OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_1 swigDelegate1;

		private OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_2 swigDelegate2;

		private OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_3 swigDelegate3;

		private OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_4 swigDelegate4;

		private OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_5 swigDelegate5;

		private OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_6 swigDelegate6;

		private OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_7 swigDelegate7;

		private OdEdCommandStackReactor.SwigDelegateOdEdCommandStackReactor_8 swigDelegate8;

		private static Type[] swigMethodTypes0 = new Type[]
		{
			typeof(OdRxClass)
		};

		private static Type[] swigMethodTypes1 = new Type[0];

		private static Type[] swigMethodTypes2 = new Type[]
		{
			typeof(OdEdCommand)
		};

		private static Type[] swigMethodTypes3 = new Type[]
		{
			typeof(OdEdCommand)
		};

		private static Type[] swigMethodTypes4 = new Type[]
		{
			typeof(OdEdCommand),
			typeof(OdEdCommandContext)
		};

		private static Type[] swigMethodTypes5 = new Type[]
		{
			typeof(OdEdCommand),
			typeof(OdEdCommandContext)
		};

		private static Type[] swigMethodTypes6 = new Type[]
		{
			typeof(OdEdCommand),
			typeof(OdEdCommandContext)
		};

		private static Type[] swigMethodTypes7 = new Type[]
		{
			typeof(OdEdCommand),
			typeof(OdEdCommandContext)
		};

		private static Type[] swigMethodTypes8 = new Type[]
		{
			typeof(string),
			typeof(OdEdCommandContext)
		};

		public delegate IntPtr SwigDelegateOdEdCommandStackReactor_0(IntPtr protocolClass);

		public delegate IntPtr SwigDelegateOdEdCommandStackReactor_1();

		public delegate void SwigDelegateOdEdCommandStackReactor_2(IntPtr pCommand);

		public delegate void SwigDelegateOdEdCommandStackReactor_3(IntPtr pCommand);

		public delegate void SwigDelegateOdEdCommandStackReactor_4(IntPtr pCommand, IntPtr pCmdCtx);

		public delegate void SwigDelegateOdEdCommandStackReactor_5(IntPtr pCommand, IntPtr pCmdCtx);

		public delegate void SwigDelegateOdEdCommandStackReactor_6(IntPtr pCommand, IntPtr pCmdCtx);

		public delegate void SwigDelegateOdEdCommandStackReactor_7(IntPtr pCommand, IntPtr pCmdCtx);

		public delegate IntPtr SwigDelegateOdEdCommandStackReactor_8([MarshalAs(UnmanagedType.LPWStr)] string commandName, IntPtr pCmdCtx);
	}
}
